<ui:composition template="/WEB-INF/template/mainTemplate.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui">
    <ui:param name="activePage" value="create"/>
    <ui:define name="metadata">
        <f:metadata>
            <f:event type="preRenderView" listener="#{learningEventCreateController.init}"/>
        </f:metadata>
    </ui:define>
    <ui:define name="content">
        <div>
            <h1>#{msgs['create.learningEvent']}</h1>
            <h:form id="form" styleClass="form-horizontal">
                <p:messages errorClass="error" autoUpdate="true"/>
                <p:panel id="step1" rendered="#{learningEventWizardModel.currentStep == 'DEFINE_LEARNING_EVENT'}">
                    <ui:include src="createLearningEvent_1.xhtml"/>

                    <div class="control-group">
                        <div class="controls">
                            <p:commandButton action="#{learningEventCreateController.prepareTimeSlotDefinitionStep}"
                                             value="Next Step" update="@form"/>
                        </div>
                    </div>
                </p:panel>
                <p:panel id="step2" rendered="#{learningEventWizardModel.currentStep == 'DEFINE_TIMESLOTS'}">
                    <ui:include src="createLearningEvent_2.xhtml"/>

                    <div class="control-group">
                        <div class="controls">
                            <p:commandButton
                                    action="#{learningEventCreateController.prepareLearningEventDefinitionStep}"
                                    value="Previous Step" update="@form"/>
                            <p:commandButton action="#{learningEventCreateController.prepareSendInvitationsStep}"
                                             value="Next Step" update="@form"/>
                        </div>
                    </div>
                </p:panel>

                <p:panel id="step3" rendered="#{learningEventWizardModel.currentStep == 'SEND_INVITATIONS'}">
                    <ui:include src="createLearningEvent_3.xhtml"/>

                    <div class="control-group">
                        <div class="controls">
                            <p:commandButton action="#{learningEventCreateController.prepareTimeSlotDefinitionStep}"
                                             value="Previous Step" update="@form"/>
                            <p:commandButton action="#{learningEventCreateController.createAndSaveLearningEvent}"
                                             value="Finish" ajax="false"/>
                        </div>
                    </div>
                </p:panel>
            </h:form>
        </div>
        <div class="clear"></div>
    </ui:define>
</ui:composition>